# -*- coding: utf-8 -*-

# __date:       2021/6/30
# __author:     Yang Chao
# __function:   ZigZag Conversion


class Solution:


    def convert(self, s: str, numRows: int) -> str:
        if numRows < 2: return s
        str_arr = ["" for _ in range(numRows)]
        numRows -= 1
        index = 1
        step = -1
        for i in s:
            index += step
            str_arr[index] += i
            if index % numRows == 0:
                step *= -1
        return "".join(str_arr)
